package com.xianzhiOA.service.impl;/**
 * Created by Administrator on 2017/5/26.
 */

import com.xianzhiOA.bean.Xzpower;
import com.xianzhiOA.dao.XzpowerMapper;
import com.xianzhiOA.service.XzpowerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 权限表
 *
 * @author 王诗博
 * @create 2017-05-26 15:45
 **/
@Service("xzpowerService")
public class XzpowerServiceImpl implements XzpowerService {
    @Autowired
    private XzpowerMapper powerMapper;

    //查询所有权限
    @Override
    public List<Xzpower> selAll() {
        List<Xzpower> powerList=powerMapper.selAll();
        return powerList;
    }
    //查询所有父级权限
    @Override
    public List<Xzpower> selsuperNoAll() {
        return powerMapper.selsuperNoAll();
    }
    //根据父级权限查询权限表中本级权限序列最大的值
    @Override
    public String  selePowerNoMaxOne(String superNo) {
        String  newValue=powerMapper.selePowerNoMaxOne(superNo);
        return newValue;
    }
    //根据权限ID查询
    @Override
    public Xzpower selectByPrimaryKey(Long powerId) {
        return powerMapper.selectByPrimaryKey(powerId);
    }

    //添加权限
    @Override
    public int insertPower(Xzpower power) {
        int i=powerMapper.insertPower(power);
        return i;
    }
    //根据权限ID伪删除
    @Override
    public int phoneyDeleteByPrimaryKey(Xzpower xzpower) {
        int i=powerMapper.phoneyDeleteByPrimaryKey(xzpower);
        return i;
    }
    //根据模块级（父级）的id查询权限级别
    @Override
    public List<Xzpower> selePowerLevel(String superNo) {
        return powerMapper.selePowerLevel(superNo);
    }

    //根据权限级的ID查询
    @Override
    public Xzpower seleByPowerNo(String powerNo) {
        return powerMapper.seleByPowerNo(powerNo);
    }
    //根据角色ID查询出所对应的所有权限
    @Override
    public List<Xzpower> selectByRoleId(Long roleId) {
        List<Xzpower> XzpowerList=powerMapper.selectByRoleId(roleId);
        return powerMapper.selectByRoleId(roleId);
    }
    //查询出权限类型最大的值

    @Override
    public int selePowerTypeMaxOne() {
        return powerMapper.selePowerTypeMaxOne();
    }
}
